/**
 * 所有的ajax服务调用
 */

AdminService = {
	'Login' : function(user_id, pwd) {
		// 登陆功能
		var lst_sku = new Array();
		lst_sku.push('user_id=' + user_id);
		lst_sku.push('password=' + pwd);
		var str_param = lst_sku.join('&');

		
		var result = null;
		
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/admin/login',
			data : str_param,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
				
			},
			error : function(e) {
				result = {};
	    		  result.IsSuccess = 0;
	    		  result.ErrorMsg = err_text;
	    		  result.ErrorCode = 4;
			}
		});
		return result;
	},
	'Test' : function(param) {
		// 登陆功能
		var lst_sku = new Array();
		lst_sku.push('param=' + param);
		var str_param = lst_sku.join('&');

		
		var result = null;
		
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/admin/test',
			data : str_param,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
				
			},
			error : function(e) {
				result = {};
	    		  result.IsSuccess = 0;
	    		  result.ErrorMsg = err_text;
	    		  result.ErrorCode = 4;
			}
		});
		return result;
	},
	'Logout' : function(user_id, pwd) {
		// 登陆功能
		var lst_param = new Array();
		lst_param.push('user_id=' + user_id);
		var str_param = lst_param.join('&');
		var result = null;
		
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/admin/logout',
			data : str_param,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
			},
        	  error : function(e, err_name, err_text) {
        		  result = {};
        		  result.IsSuccess = 0;
        		  result.ErrorMsg = err_text;
        		  result.ErrorCode = 4;
        	  }
		});
		return result;
	},
};


PromoterService = {
	'SearchPromoterList': function(promoter_id, cellphone, promoter_type, promoter_name, page_index, page_size){
		// 申请提现
		var lst_sku = new Array();
		lst_sku.push('promoter_id=' + promoter_id);
		lst_sku.push('cellphone=' 	+ cellphone);
		lst_sku.push('promoter_type=' + promoter_type);
		lst_sku.push('promoter_name=' + promoter_name);
		lst_sku.push('page_index=' 	+ page_index);
		lst_sku.push('page_size=' 	+ page_size);
		var str_param = lst_sku.join('&');

		
		var result = null;
		
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/promoter/searchPromoterList',
			data : str_param,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
			},
      	  error : function(e, err_name, err_text) {
    		  result = {};
    		  result.IsSuccess = 0;
    		  result.ErrorMsg = err_text;
    		  result.ErrorCode = 4;
    	  }
		});
		return result;
	},
	'SearchAmountList': function( promoter_id, page_index, page_size){
		// 申请提现
		var lst_sku = new Array();
		lst_sku.push('promoter_id=' + promoter_id);
		lst_sku.push('page_index=' 	+ page_index);
		lst_sku.push('page_size=' 	+ page_size);
		var str_param = lst_sku.join('&');

		
		var result = null;
		
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/promoter/searchAmountList',
			data : str_param,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
			},
      	  error : function(e, err_name, err_text) {
    		  result = {};
    		  result.IsSuccess = 0;
    		  result.ErrorMsg = err_text;
    		  result.ErrorCode = 4;
    	  }
		});
		return result;
	},
	'SearchWithdrawAmountList': function( promoter_id, page_index, page_size){
		// 申请提现
		var lst_sku = new Array();
		lst_sku.push('promoter_id=' + promoter_id);
		lst_sku.push('page_index=' 	+ page_index);
		lst_sku.push('page_size=' 	+ page_size);
		var str_param = lst_sku.join('&');

		
		var result = null;
		
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/promoter/searchWithdrawAmountList',
			data : str_param,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
			},
      	  error : function(e, err_name, err_text) {
    		  result = {};
    		  result.IsSuccess = 0;
    		  result.ErrorMsg = err_text;
    		  result.ErrorCode = 4;
    	  }
		});
		return result;
	},
	'SearchWithdrawList': function(promoter_id, promoter_name, status, page_index, page_size){
		// 申请提现
		var lst_sku = new Array();
		lst_sku.push('promoter_id=' + promoter_id);
		lst_sku.push('promoter_name=' + promoter_name);
		lst_sku.push('status=' + status);
		lst_sku.push('page_index=' 	+ page_index);
		lst_sku.push('page_size=' 	+ page_size);
		var str_param = lst_sku.join('&');

		
		var result = null;
		
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/promoter/searchWithdrawList',
			data : str_param,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
			},
      	  error : function(e, err_name, err_text) {
    		  result = {};
    		  result.IsSuccess = 0;
    		  result.ErrorMsg = err_text;
    		  result.ErrorCode = 4;
    	  }
		});
		return result;
	},
	'UpdateAmount': function(promoter_id, amount, amount_type, remark){
		var lst_sku = new Array();
		lst_sku.push('promoter_id=' 	+ promoter_id);
		lst_sku.push('amount=' 		+ amount);
		lst_sku.push('amount_type=' 	+ amount_type);
		lst_sku.push('remark=' 	+ remark);
		var str_param = lst_sku.join('&');

		
		var result = null;
		
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/promoter/updateAmount',
			data : str_param,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
			},
      	  error : function(e, err_name, err_text) {
    		  result = {};
    		  result.IsSuccess = 0;
    		  result.ErrorMsg = err_text;
    		  result.ErrorCode = 4;
    	  }
		});
		return result;
	},
	'UpdatePromoterStatus': function(promoter_id,status,reject_reason){
		var lst_sku = new Array();
		lst_sku.push('promoter_id=' 	+ promoter_id);
		lst_sku.push('reject_reason=' 	+ reject_reason);
		lst_sku.push('status=' 		+ status);
		var str_param = lst_sku.join('&');
		var result = null;
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/promoter/updatePromoterStatus',
			data : str_param,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
			},
      	  error : function(e, err_name, err_text) {
    		  result = {};
    		  result.IsSuccess = 0;
    		  result.ErrorMsg = err_text;
    		  result.ErrorCode = 4;
    	  }
		});
		return result;
	},
	'ResetPwd': function(promoter_id){
		// 申请提现
		var lst_sku = new Array();
		lst_sku.push('promoter_id=' 	+ promoter_id);
		var str_param = lst_sku.join('&');

		var result = null;
		
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/promoter/resetPwd',
			data : str_param,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
			},
      	  error : function(e, err_name, err_text) {
    		  result = {};
    		  result.IsSuccess = 0;
    		  result.ErrorMsg = err_text;
    		  result.ErrorCode = 4;
    	  }
		});
		return result;
	},
};


OrderService = {
		'SearchOrderList': function(promoter_id, promoter_name, order_id,
									order_status, payment_status, order_type,
									begin_order_date, end_order_date,
									page_index, page_size){
			var lst_sku = new Array();
			lst_sku.push('promoter_id=' 	+ promoter_id);
			lst_sku.push('promoter_name='	+ promoter_name);
			lst_sku.push('order_id=' 		+ order_id);
			lst_sku.push('order_status=' 	+ order_status);
			lst_sku.push('payment_status=' 	+ payment_status);
			lst_sku.push('order_type=' 		+ order_type);
			lst_sku.push('begin_order_date='+ begin_order_date);
			lst_sku.push('end_order_date=' 	+ end_order_date);
			lst_sku.push('page_index=' 		+ page_index);
			lst_sku.push('page_size=' 		+ page_size);
			var str_param = lst_sku.join('&');

			var result = null;
			
			$.ajax({
				type : 'post',
				url : '/AjaxService/center/order/searchOrderList',
				data : str_param,
				dataType : 'json',
				async : false,
				success : function(data) {
					result = data;
				},
	      	  error : function(e, err_name, err_text) {
	    		  result = {};
	    		  result.IsSuccess = 0;
	    		  result.ErrorMsg = err_text;
	    		  result.ErrorCode = 4;
	    	  }
			});
			return result;
		},
		'CancelOrder': function(order_id){
			var lst_sku = new Array();
			lst_sku.push('order_id='+ order_id);
			var str_param = lst_sku.join('&');

			var result = null;
			
			$.ajax({
				type : 'post',
				url : '/AjaxService/center/order/cancelOrder',
				data : str_param,
				dataType : 'json',
				async : false,
				success : function(data) {
					result = data;
				},
	      	  error : function(e, err_name, err_text) {
	    		  result = {};
	    		  result.IsSuccess = 0;
	    		  result.ErrorMsg = err_text;
	    		  result.ErrorCode = 4;
	    	  }
			});
			return result;
		},
};


SkuService = {
	'SearchSkuList': function(style_sn, style_name,is_buy_fz, page_index, page_size){
		var lst_sku = new Array();
		lst_sku.push('style_sn=' + style_sn);
		lst_sku.push('style_name=' 	+ style_name);
		lst_sku.push('is_buy_fz=' 	+ is_buy_fz);
		lst_sku.push('page_index=' 	+ page_index);
		lst_sku.push('page_size=' 	+ page_size);
		var str_param = lst_sku.join('&');

		var result = null;
		
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/sku/searchSkuList',
			data : str_param,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
			},
      	  error : function(e, err_name, err_text) {
    		  result = {};
    		  result.IsSuccess = 0;
    		  result.ErrorMsg = err_text;
    		  result.ErrorCode = 4;
    	  }
		});
		return result;
	},
	'UpdateSku': function( sku_id ,  sku_sn,  sku_name,  taobao_sku_id, taobao_sku_properties_name ,
			 style_sn, style_name, promotion_text, taobao_style_id , taobao_style_name,
			 taobao_category_id , sku_dimension_id1 , sku_dimension_name1 , sku_dimension_value1 ,
			 sku_dimension_id2, sku_dimension_name2, sku_dimension_value2 , market_price ,
			 sale_price,  person_commission_amount, dealer_commission_amount, image, image_list ,
			 material_no , material_desc, code ,  haier_material_no,  material_length ,
			 material_width, material_height , material_volume , material_weight , is_buy_fz,
			 status ){
		var lst_sku = new Array();
		lst_sku.push('sku_id=' 	+ sku_id);
		lst_sku.push('sku_sn=' 	+ sku_sn);
		lst_sku.push('sku_name=' 	+ sku_name);
		lst_sku.push('taobao_sku_id=' 	+ taobao_sku_id);
		lst_sku.push('taobao_sku_properties_name=' 	+ taobao_sku_properties_name);
		lst_sku.push('style_sn=' 	+ style_sn);
		lst_sku.push('style_name=' 	+ style_name);
		lst_sku.push('promotion_text=' 	+ promotion_text);
		lst_sku.push('taobao_style_id=' 	+ taobao_style_id);
		lst_sku.push('taobao_style_name=' 	+ taobao_style_name);
		lst_sku.push('taobao_category_id=' 	+ taobao_category_id);
		lst_sku.push('sku_dimension_id1=' 	+ sku_dimension_id1);
		lst_sku.push('sku_dimension_name1=' 	+ sku_dimension_name1);
		lst_sku.push('sku_dimension_value1=' 	+ sku_dimension_value1);
		lst_sku.push('sku_dimension_id2=' 	+ sku_dimension_id2);
		lst_sku.push('sku_dimension_name2=' 	+ sku_dimension_name2);
		lst_sku.push('sku_dimension_value2=' 	+ sku_dimension_value2);
		lst_sku.push('market_price=' 	+ market_price);
		lst_sku.push('sale_price=' 	+ sale_price);
		lst_sku.push('person_commission_amount=' 	+ person_commission_amount);
		lst_sku.push('dealer_commission_amount=' 	+ dealer_commission_amount);
		lst_sku.push('image=' 	+ image);
		lst_sku.push('image_list=' 	+ image_list);
		lst_sku.push('material_no=' 	+ material_no);
		lst_sku.push('material_desc=' 	+ material_desc);
		lst_sku.push('code=' 	+ code);
		lst_sku.push('haier_material_no=' 	+ haier_material_no);
		lst_sku.push('material_length=' 	+ material_length);
		lst_sku.push('material_width=' 	+ material_width);
		lst_sku.push('material_height=' 	+ material_height);
		lst_sku.push('material_volume=' 	+ material_volume);
		lst_sku.push('material_weight=' 	+ material_weight);
		lst_sku.push('is_buy_fz=' 	+ is_buy_fz);
		lst_sku.push('status=' 	+ status);
		var str_sku = lst_sku.join('&');
		var result = null;
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/sku/updateSku',
			data : str_sku,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
			},
      	  error : function(e, err_name, err_text) {
    		  result = {};
    		  result.IsSuccess = 0;
    		  result.ErrorMsg = err_text;
    		  result.ErrorCode = 4;
    	  }
		});
		return result;
	},
	'AddSku': function( sku_sn,  sku_name,  taobao_sku_id, taobao_sku_properties_name ,
			 style_sn, style_name, promotion_text, taobao_style_id , taobao_style_name,
			 taobao_category_id , sku_dimension_id1 , sku_dimension_name1 , sku_dimension_value1 ,
			 sku_dimension_id2, sku_dimension_name2, sku_dimension_value2 , market_price ,
			 sale_price,  person_commission_amount, dealer_commission_amount, image, image_list ,
			 material_no , material_desc, code ,  haier_material_no,  material_length ,
			 material_width, material_height , material_volume , material_weight , is_buy_fz,
			 status ){
		var lst_sku = new Array();
		lst_sku.push('sku_sn=' 	+ sku_sn);
		lst_sku.push('sku_name=' 	+ sku_name);
		lst_sku.push('taobao_sku_id=' 	+ taobao_sku_id);
		lst_sku.push('taobao_sku_properties_name=' 	+ taobao_sku_properties_name);
		lst_sku.push('style_sn=' 	+ style_sn);
		lst_sku.push('style_name=' 	+ style_name);
		lst_sku.push('promotion_text=' 	+ promotion_text);
		lst_sku.push('taobao_style_id=' 	+ taobao_style_id);
		lst_sku.push('taobao_style_name=' 	+ taobao_style_name);
		lst_sku.push('taobao_category_id=' 	+ taobao_category_id);
		lst_sku.push('sku_dimension_id1=' 	+ sku_dimension_id1);
		lst_sku.push('sku_dimension_name1=' 	+ sku_dimension_name1);
		lst_sku.push('sku_dimension_value1=' 	+ sku_dimension_value1);
		lst_sku.push('sku_dimension_id2=' 	+ sku_dimension_id2);
		lst_sku.push('sku_dimension_name2=' 	+ sku_dimension_name2);
		lst_sku.push('sku_dimension_value2=' 	+ sku_dimension_value2);
		lst_sku.push('market_price=' 	+ market_price);
		lst_sku.push('sale_price=' 	+ sale_price);
		lst_sku.push('person_commission_amount=' 	+ person_commission_amount);
		lst_sku.push('dealer_commission_amount=' 	+ dealer_commission_amount);
		lst_sku.push('image=' 	+ image);
		lst_sku.push('image_list=' 	+ image_list);
		lst_sku.push('material_no=' 	+ material_no);
		lst_sku.push('material_desc=' 	+ material_desc);
		lst_sku.push('code=' 	+ code);
		lst_sku.push('haier_material_no=' 	+ haier_material_no);
		lst_sku.push('material_length=' 	+ material_length);
		lst_sku.push('material_width=' 	+ material_width);
		lst_sku.push('material_height=' 	+ material_height);
		lst_sku.push('material_volume=' 	+ material_volume);
		lst_sku.push('material_weight=' 	+ material_weight);
		lst_sku.push('is_buy_fz=' 	+ is_buy_fz);
		lst_sku.push('status=' 	+ status);
		var str_sku = lst_sku.join('&');
		var result = null;
		$.ajax({
			type : 'post',
			url : '/AjaxService/center/sku/addSku',
			data : str_sku,
			dataType : 'json',
			async : false,
			success : function(data) {
				result = data;
			},
     	  error : function(e, err_name, err_text) {
   		  result = {};
   		  result.IsSuccess = 0;
   		  result.ErrorMsg = err_text;
   		  result.ErrorCode = 4;
   	  }
		});
		return result;
	},
};
